package org.ohos.sample.cordova;

import org.ffsky.jsplugin.ExposedJsApi;

public class HarExposedJsApi implements ExposedJsApi {

    private WebViewEngine mWebViewEngine;
    public HarExposedJsApi(WebViewEngine webViewEngine){
        mWebViewEngine = webViewEngine;
    }
    @Override
    public void evaluateJavascript(String js) {
        if(mWebViewEngine!=null){
            mWebViewEngine.evaluateJavascript(js);
        }
    }

    @Override
    public String getWebViewUrl() {
        if(mWebViewEngine!=null){
            return mWebViewEngine.getUrl();
        }
        return null;
    }

    @Override
    public void dispose() {
        mWebViewEngine = null;
    }
}
